window.onload = function() {
	//关闭顶部广告图
	var close_ad = document.getElementById("close_ad");//获取关闭按钮
		var topbanner = document.getElementById("topBanner");//获取广告图的div
		close_ad.onclick = function(){
		topbanner.style.display = "none";
		}
		
	//倒计时
	function checkTime(i){
		if(i<10){
			i = "0" + i;
		}
		return i;
	}
	function FreshTime(){
	var endTime = new Date('2019/5/31,12:00:00');
	var nowTime = new Date();
	var minusTime = parseInt((endTime.getTime()-nowTime.getTime())/1000);//毫秒换成秒
	var h = parseInt(minusTime/(60*60)%24);//获取小时
	var m = parseInt(minusTime/60%60);//获取分
	var s = parseInt(minusTime%60);//获取秒
	h = checkTime(h);
	m = checkTime(m);
	s = checkTime(s);
	document.getElementById('h').innerHTML = h;
	document.getElementById('m').innerHTML = m;
	document.getElementById('s').innerHTML = s;
	if(minusTime<=0){
	    document.getElementById("minusTime").innerHTML="团购已结束";
	    clearInterval(sh);
	}
	}
	FreshTime();
	var sh;
   	sh = setInterval(FreshTime,500);
}